<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-logic" prefix="logic" %>
<%@page import = "java.sql.ResultSet" %>

<%--
The taglib directive below imports the JSTL library. If you uncomment it,
you must also add the JSTL library to the project. The Add Library... action
on Libraries node in Projects view can be used to add the JSTL 1.1 library.
--%>
<%--
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> 
--%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
        <title>Magazine Flow Controller</title>
        <link rel="stylesheet" type="text/css" href="style.css"/>
    </head>
    <body>
        <div class="wrapper">
        <div class="navbg">
            <div id="navcontainer">
                <span style="color: #ffffff; font-weight: bold; top: 20px; position: relative; float: left; left: 20px; ">Bem Vindo <bean:write name="usuario" property="nome"/>! | <a href="Logout.do">Logout</a></span>
            </div>
        </div>
        <div class="banner">
            <div class="bannerontop"><a href="#" style="font-size: 24pt; color: #ffffff; font-weight: bold;">Magazine Flow Controller</a></div>
            <div class="content">
                <div class="leftcolumn">
                    <h2>Navegação</h2>
                        <div class="navvy">
                            <ul class="navvylist">
                                <li><a href="index.jsp">Home</a></li>
                                <li><a href="InscreveLista.do">Assinar Revista</a></li>
                                <li><a href="CancelaLista.do">Cancelar Assinatura</a></li>
                                <li><a href="ConsultaLista.do">Revistas Assinadas</a></li>
                                <li><a href="ConsultaRevista.do">Consultar Revistas</a></li>
                            </ul>
                        </div>
                        <logic:equal name="usuario" property="id_cargo" value="6">
                            <h2>Administrador</h2>
                            <div class="navvy">
                                <ul class="navvylist">
                                    <li><a href="CadastroRevista.jsp">Cadastrar Revista</a></li>
                                    <li><a href="ConsultaRevista.do">Consultar Revistas</a></li>
                                    <li><a href="cadastraUsuario.jsp">Cadastra Usuário</a></li>
                                    <li><a href="alteraUsuario.jsp">Altera Usuário</a></li>
                                    <li><a href="removeUsuario.jsp">Remove Usuário</a></li>
                                    <li><a href="relatorio_revistas.jsp">Obter Relatorio de Revistas</a></li>
                                    <li><a href="relatorio_usuarios.jsp">Obter Relatorio de Usuarios</a></li>
                                    <li><a href="relUsuariosCadastrados.jsp">Lista de Usuários</a></li>
                                </ul>
                            </div>
                        </logic:equal>
                </div>
                <div class="rightcolumn">
                    <h3>Alteração de Usuário</h3>
                    <div class="info">Altera os dados pessoais de um usuário</div>
                    <div class="maincontevt">
                        <form action="AlteraUsuario.do" method="post">
                            <p> Nome: <input type="text" name="nomeUsuario" /><br></p>
                            <p> Cargo: <select name="cargo" /><br></p>
                            <% br.usp.poli.mfc.struts.DAO.UsuarioDAO usuarioDAO = br.usp.poli.mfc.struts.DAO.DAOFactory.getUsuarioDAO();
                            ResultSet rs = usuarioDAO.getCargo();
                            if(rs != null)
                                while(rs.next()){%>
                            <option value="<%=rs.getInt("IDCARGO")%>"><%=rs.getString("NOME_CARGO")%></option>
                            <% } %>
                            </select></p>
                            <p> Departamento: <select name="departamento" /><br></p>
                            <% br.usp.poli.mfc.struts.DAO.UsuarioDAO _usuarioDAO = br.usp.poli.mfc.struts.DAO.DAOFactory.getUsuarioDAO();
                            ResultSet rs1 = _usuarioDAO.getDepartamentos();
                            if(rs1 != null)
                                while(rs1.next()){%>
                            <option value="<%=rs1.getInt("IDDEPARTAMENTO")%>"><%=rs1.getString("NOME_DEPARTAMENTO")%></option>
                            <% } %>
                            </select></p>
                            <p></p>
                            <p><input type="submit" value="Confirma"/></p>
                        </form>
                    </div>
                </div>
                <div class="footer">Magazine Flow Controller - POLI-USP 2007</div>
            </div>
        </div>
    </body>
</html>